#!/sbin/openrc-run

# user-servicable parts go in /etc/conf.d/althttpd
pidfile=/var/run/althttpd.pid

depend() {
	need net
}

start() {
	ebegin "Starting althttpd"

	cd /
	start-stop-daemon \
		--start --exec /usr/bin/althttpd \
		--pidfile ${pidfile} \
		--make-pidfile \
		--background \
		-- \
		${ALTHTTPD_OPTS}

	eend $? "Failed to start althttpd"
}

stop() {
	ebegin "Stopping althttpd"
	start-stop-daemon --retry 10 --stop --pidfile ${pidfile}
	eend $? "Failed to stop althttpd"
}
